<template>
	<div names="www" class="qop" @click="show">
		<topTitle @closep="closeThis" :des="title"></topTitle>
		<jiben name="wjp1" ref="waterLine" v-if="blocks[0].status" @refreshTop="refreshTop" @closep="closeThis" :img="img" :msg="blocks[0]" >111111111</jiben>
		<live name="wjp" ref="waterLine" v-if="blocks[1].status" @refreshTop="refreshTop" @closep="closeThis" :msg="blocks[1]" >111111111</live>
		<waterLine name="wjp" ref="waterLine"  v-if="blocks[2].status" @refreshTop="refreshTop" @closep="closeThis" :msg="blocks[2]" >111111111</waterLine>

		<wind name="wjp" ref="waterLine" v-if="blocks[3].status" @refreshTop="refreshTop" @closep="closeThis" :msg="blocks[4]" >111111111</wind>
		<Weather12 name="wjp" ref="waterLine" v-if="blocks[4].status" @refreshTop="refreshTop" @closep="closeThis" :msg="blocks[4]" >111111111</Weather12>

		<temp name="wjp" ref="waterLine" v-if="blocks[5].status" @refreshTop="refreshTop" @closep="closeThis" :msg="blocks[4]" >111111111</temp>

		<mianyu name="wjp" ref="waterLine" v-if="blocks[6].status" @refreshTop="refreshTop" @closep="closeThis" :msg="blocks[3]" >111111111</mianyu>
		<shuiwei name="wjp" ref="waterLine"  v-if="blocks[7].status" @refreshTop="refreshTop" @closep="closeThis" :msg="blocks[2]" >111111111</shuiwei>
		<liveWater name="wjp" ref="waterLine"  v-if="blocks[8].status" @refreshTop="refreshTop" @closep="closeThis" :msg="blocks[2]" >111111111</liveWater>
		<oldWarn name="wjp" ref="waterLine"  v-if="blocks[10].status" @refreshWarn="refreshWarn" @refreshTop="refreshTop" @closep="closeThis" :msg="blocks[2]" >111111111</oldWarn>
		<zonghe name="wjp" ref="waterLine"  v-if="blocks[11].status" @refreshTop="refreshTop" @closep="closeThis" :msg="blocks[2]" >111111111</zonghe>

	</div>

</template>

<script>
import topTitle from './indexComponents/top'
import Weather12 from './indexComponents/Weather12';
import jiben from './indexComponents/jiben';
import live from './indexComponents/live';
import maxWind from './indexComponents/maxWind';
import mianyu from './indexComponents/mianyu';
import waterLine from './indexComponents/waterLine';
import shuiwei from './indexComponents/shuiwei';
import temp from './indexComponents/temp';
import wind from './indexComponents/wind';
import liveWater from './indexComponents/liveWater';
import oldWarn from './indexComponents/oldWarn';
import zonghe from './indexComponents/zonghe';
export default {
    props:["msg","img"],
	components: {
        topTitle,Weather12,waterLine,maxWind,live,jiben,temp,shuiwei,wind,mianyu,liveWater,oldWarn,zonghe
	},
	methods:{
        refreshWarn(num){
            this.$emit('refreshWarn',num)
        },
        closeThis(){
            this.$emit('closep',this.title.name)
		},
		refreshTop(data){
			// //console.log(data);
			this.title=data;
		},
		show(){
			// //console.log(this.msg);
		},
		refreshWater(num){
			console.log(num)
			console.log(this.$refs.waterLine)
            this.$refs.waterLine.refreshData();
        },
		sortLe(){
			this.$refs.waterLine.refreshAll();
		},
		refreshAll(){
			// //console.log(this.$refs.waterLine.$attrs);
			if(this.blocks[0].status){
				this.$refs.waterLine.refreshAll();
			}

			setTimeout(()=>{
				// //console.log(this.blocks)
				for(var i=0;i<this.blocks.length;i++){
					this.blocks[i].status=false;
					if(this.blocks[i].name==this.msg){
						// //console.log(this.blocks[i].name,this.msg)
						// this.title=this.msg;
						this.blocks[i].status=true;
					}
				}
				// //console.log(this.blocks)
			},100)

		}
    },
	data() {
		return {
			title:"",
			name:"",
			blocks: [
                {name: "基本信息",status: false,title: '1111111111',  sort:true,},
                {name: "实况告警信息",status: false,title: '2222222222',sort:true,},
                {name: "降水信息",status: false,title: '3333333333',sort:true,},
                {name: "极大风信息",status: false,title: '444444444',sort:false,},
                {name: "近12小时逐小时最大雨量",status: false,title: '555555555',sort:true,},
                {name: "温度信息",status: false,title: '555555555',sort:true,},
                {name: "雨量排行",status: false,title: '555555555',sort:true,},
                {name: "水位信息",status: false,title: '555555555',sort:true,},
                {name: "实况降水图",status: false,title: '555555555',sort:true,},
                {name: "水位24小时趋势图",status: false,title: '555555555',sort:true,},
                {name: "预警",status: false,title: '555555555',sort:true,},
                {name: "综合概况",status: false,title: '555555555',sort:true,},
            ],
		}
	},
	mounted(){
		this.refreshAll();
		this.name=this.title.name;
	}
}
</script>

<style lang="less">

</style>